//
//  H264ParseSPS.h
//
//  Created by lzj<lizhijian_21@163.com> on 2018/7/6.
//  Copyright © 2018年 LZJ. All rights reserved.
//

#ifndef H264ParseSPS_h
#define H264ParseSPS_h
#ifdef __cplusplus
extern "C"
{
#endif
#include <stdio.h>

typedef struct
{
    unsigned int profile_idc;
    unsigned int level_idc;

    unsigned int width;
    unsigned int height;
    unsigned int fps;       //SPS中可能不包含FPS信息
} sps_info_struct;

struct metadata_t
{
    double m_duration;
    double m_width;
    double m_height;
    double m_framerate;
    double m_videodatarate;
    double m_audiodatarate;
    double m_videocodecid;
    double m_audiocodecid;
    double m_audiosamplerate;
    double m_audiosamplesize;

    int m_hasautio:1;
    int m_stereo:1;
    int m_chn:4;            // 通道号
//    string title;       // 标题
//    string comment;     // 注释
};

/**
 解析SPS数据信息

 @param data SPS数据内容，需要Nal类型为0x7数据的开始(比如：67 42 00 28 ab 40 22 01 e3 cb cd c0 80 80 a9 02)
 @param dataSize SPS数据的长度
 @param info SPS解析之后的信息数据结构体
 @return success:1，fail:0

 */
int h264_parse_sps(const unsigned char *data, unsigned int dataSize, sps_info_struct *info);
int h264_is_bframe(unsigned char *pdata, size_t len);

#ifdef __cplusplus
}
#endif
#endif /* H264ParseSPS_h */
